<!--修改方案-->
<template>
  <div class="modify-scheme-box"
       v-loading="loading"
       element-loading-customClass="ne-loading"
       element-loading-background="rgba(255, 255, 255, 0.6)"
  >
    <el-form
        ref="TcForm2"
        label-position="left"
        label-width="1.2rem"
        :model="Form"
    >
      <el-row>
        <tc-form2 :rules="rules" :form="Form"></tc-form2>
      </el-row>
      <el-row>
        <h2 class="ne-title-v2">境外国际段/海外公司自有</h2>
        <OverSeaTable v-bind="$attrs" v-on="$listeners" ref="OverSeaTable" :OStbs="OStbs"></OverSeaTable>
        <h2 class="ne-title-v2">境外本地段</h2>
        <LocalTable v-bind="$attrs" v-on="$listeners" ref="LocalTable" :LTtbs="LTtbs"></LocalTable>
        <tc-form2 :form="Form2"></tc-form2>
        <el-col :span="24" class="text-center">
          <el-button type="primary" size="medium" @click="validate">保存</el-button>
          <el-button size="medium" @click="closeFun">取消</el-button>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import TcForm2 from "@/components/public/TcForm2";
import OverSeaTable from "@/components/custorder/pengding/OverSeaTable";
import LocalTable from "@/components/custorder/pengding/LocalTable";
import CustOrderService from "@/api/order/CustOrderService";
import { mapState } from "vuex";

export default {
  name: "ModifyScheme",
  data() {
    return {
      loading: false,
      rules:{
        ROUTE_TYPE:[
          { required: true, message: '请选择通达方式', trigger: 'change' }
        ],
        EXPORT_ORG_ID:[
          { required: true, message: '请选择出境的ITMC', trigger: 'change' }
        ],
        MAINTAIN_LEVEL_FLAG:[
          { required: true, message: '请选择电路维护等级是否具备', trigger: 'change' },
          { required: true, message: '请选择电路维护等级是否具备', trigger: 'blur' }
        ],
        ACT_DATE:[
          { required: true, message: '请选择有效期', trigger: 'change' },
          { required: true, message: '请选择有效期', trigger: 'blur' }
        ],
        IS_WRONG_ORDER:[
          { required: true, message: '请选择错单标识', trigger: 'change' }
        ]
      },
      Form: {
        "ROUTE_TYPE": {
          type: 'select',
          name: '通达方式',
          value: "",
          attrId: '9158',
          sqlId: '2021052112',
          interFaceType: 'ORDER',
          options: [],
          required: true,
          show: true,
          span: 6
        },
        "EXPORT_ORG_ID": {
          type: 'select',
          name: '出境的ITMC',
          interFaceType: 'ORDER',
          popFlag: '1',
          sqlId: '2021052113',
          value: "",
          options: [],
          required: true,
          show: true,
          span: 6
        },
        "EXPORT_POP_ID": {
          type: 'select',
          name: '海外登陆POP点',
          value: "",
          interFaceType: 'ORDER',
          popFlag: '2',
          sqlId: '2021052113',
          options: [],
          show: true,
          span: 6
        },
        "OVERSEAS_NBR": {
          type: 'Ipt',
          name: '海外公司自编号',
          value: "",
          show: true,
          span: 6
        },
        "ITMC_NAME": {
          type: 'Ipt',
          name: '境内接口ITMC',
          readonly: true,
          value: "",
          show: true,
          span: 6
        },
        "MAINTAIN_LEVEL_FLAG": {
          type: 'select',
          name: '电路维护等级是否具备',
          value: "",
          options: [{label: '不具备', value: '2'}, {label: '具备', value: '1'}],
          required: true,
          show: true,
          span: 6
        },
        "MAINTAIN_LEVEL": {
          type: 'select',
          name: '电路维护等级',
          value: "",
          attrId: 9347,
          sqlId: '2021052112',
          interFaceType: 'ORDER',
          options: [],
          show: true,
          span: 6
        },
        "MAINTAIN_COMMENT": {
          type: 'Ipt',
          name: '维护等级描述',
          value: "",
          show: true,
          span: 6
        },
        "ACT_DATE": {
          type: 'date',
          name: '有效期',
          pickerOptions:{
            disabledDate (time) {
              return time.getTime() <= Date.now()//选当前时间之前的时间
            }
          },
          value: "",
          required: true,
          show: true,
          span: 6
        },
        "IS_WRONG_ORDER": {
          type: 'select',
          name: '错单标识',
          value: "",
          options: [{label: '否', value: '2'}, {label: '是', value: '1'}],
          required: true,
          show: true,
          span: 6
        },
      },
      Form2: {
        "PROPOSE_COMMENT": {
          type: 'textarea',
          name: '备注',
          value: "",
          show: true,
          span: 12
        },
      },
      LTtbs: {
        status:'', // 填报方案:TBFA 确认方案：QRFA
        tableColumns: [
          {slotName: "field1", required: true, title: "境外本地段资源及电路类型"},
          {slotName: "field2", required: true, title: "资源段所属运营商"},
          {slotName: "field3", required: true, title: "资源具备情况"},
          {slotName: "field4", required: true, title: "工期"},
          {slotName: "field5", title: "月租费"},
          {slotName: "field6", title: "安装费"},
          {slotName: "field7", title: "楼宇费"},
          {slotName: "field8", title: "设备费"},
          {slotName: "field9", required: true, title: "时延(ms)"},
          {slotName: "field10", required: true, title: "可用率"},
          {slotName: "field11", required: true, title: "抖动"},
          {slotName: "field12", required: true, title: "开始地点及结束地点"},
          {slotName: "field13", required: true, title: "路由"},
          {slotName: "field14", required: true, title: "保护模式"},
          {slotName: "field15", required: true, title: "能否代购客户端设备及费用"},
          {slotName: "btn", title: "添加"}
        ],
        rules:{
          OVERSEAS:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ROUTE_TYPE:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          OVERSEAS_OPP_ID:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
          OVERSEAS_RES_TYPE:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
          OVERSEAS_TIME:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          TIME_DELAY:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          USE_PERCENT:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          DITHER:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ADDR_START:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ADDR_END:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ROUTE:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          PROTECTED_MODE:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
          BUY_EQU_FLAG:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
        },
        init: {
          field1: {OVERSEAS: {value: ''}},
          field2: {
            OVERSEAS_OPP_ID: {
              value: '', options: []
            }
          },
          field3: {OVERSEAS_RES_TYPE: {value: '1', options: [{value: '1', label: '具备'}, {value: '2', label: '不具备'}]}},
          field4: {OVERSEAS_TIME: {value: ''}},
          field5: {
            MONEY_MONTH: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field6: {
            MONEY_SETUP: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field7: {
            MONEY_BUILDING: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field8: {
            MONEY_EQU: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field9: {TIME_DELAY: {value: ''}},
          field10: {USE_PERCENT: {value: ''}},
          field11: {DITHER: {value: ''}},
          field12: {ADDR_START: {value: ''}, ADDR_END: {value: ''}},
          field13: {ROUTE: {value: ''}},
          field14: {
            PROTECTED_MODE: {
              value: 'Others',
              options: [{value: 'Others', label: 'Others'}, {
                value: 'Unprotected',
                label: 'Unprotected'
              }, {value: 'MS-SPRING', label: 'MS-SPRING'}]
            }
          },
          field15: {BUY_EQU_FLAG: {value: '1', options: [{value: '1', label: '是'}, {value: '0', label: '否'}]}},
          field16: {EXPORT_TYPE: {value: '2'}},
          btn: {}
        },
        tableData: [],
        tableLoading: false
      },
      isRouterAlive: true,
      OStbs: {
        status:'', // 填报方案:TBFA 确认方案：QRFA
        tableColumns: [
          {slotName: "field1", required: true, title: "境外资源段及光缆方式"},
          {slotName: "field2", required: true, title: "资源段所属运营商"},
          {slotName: "field3", required: true, title: "资源具备情况"},
          {slotName: "field4", required: true, title: "工期"},
          {slotName: "field5", title: "月租费"},
          {slotName: "field6", title: "安装费"},
          {slotName: "field7", title: "设备费"},
          {slotName: "field8", required: true, title: "时延(ms)"},
          {slotName: "field9", required: true, title: "可用率"},
          {slotName: "field10", required: true, title: "抖动"},
          {slotName: "field11", required: true, title: "开始地点及结束地点"},
          {slotName: "field12", required: true, title: "路由"},
          {slotName: "field13", required: true, title: "保护模式"},
          {slotName: "btn", title: "添加"}
        ],
        rules:{
          OVERSEAS:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          CABLE_TYPE:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          OVERSEAS_OPP_ID:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
          OVERSEAS_RES_TYPE:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
          OVERSEAS_TIME:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          TIME_DELAY:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          USE_PERCENT:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          DITHER:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ADDR_START:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ADDR_END:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          ROUTE:[
            { required: true, message: '请填写', trigger: 'blur' },
            { required: true, message: '请填写', trigger: 'change' }
          ],
          PROTECTED_MODE:[
            { required: true, message: '请选择', trigger: 'change' }
          ],
        },
        init: {
          field1: {OVERSEAS: {value: ''}, CABLE_TYPE: {value: ''}},
          field2: {
            OVERSEAS_OPP_ID: {
              value: '',
              options: []
            }
          },
          field3: {OVERSEAS_RES_TYPE: {value: '1', options: [{value: '1', label: '具备'}, {value: '2', label: '不具备'}]}},
          field4: {OVERSEAS_TIME: {value: ''}},
          field5: {
            MONEY_MONTH: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field6: {
            MONEY_SETUP: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field7: {
            MONEY_EQU: {
              value: '',
              opts: {
                value: '156',
                options: [{label: '人民币', value: '156'}, {label: '美元', value: '840'}]
              }
            }
          },
          field8: {TIME_DELAY: {value: ''}},
          field9: {USE_PERCENT: {value: ''}},
          field10: {DITHER: {value: ''}},
          field11: {ADDR_START: {value: ''}, ADDR_END: {value: ''}},
          field12: {ROUTE: {value: ''}},
          field13: {
            PROTECTED_MODE: {
              value: 'Others',
              options: [{value: 'Others', label: 'Others'}, {
                value: 'Unprotected',
                label: 'Unprotected'
              }, {value: 'MS-SPRING', label: 'MS-SPRING'}]
            }
          },
          field14: {EXPORT_TYPE: {value: '1'}},
          btn: {}
        },
        tableData: [],
        tableLoading: false
      }
    }
  },
  props: {
    allInfo:{
      type: Object
    },
    projectArr:{
      type:Array,
      default: () => {
        return [];
      }
    },
    projectType:{
      type: [String,Number]
    },
    ifAdd:{
      type: [String,Boolean]
    },
    locationData:{
      type: [Object],
      default: () => {
        return {}
      }
    },
    selRowData:{
      type:Object
    }
  },
  mounted() {

  },
  created() {
    this.initOpt();
    this.getDetail();
    this.Form.ITMC_NAME.value = this.locationData.locationName;
  },
  computed:{
    ...mapState('user',['user'])
  },
  components: {TcForm2, OverSeaTable, LocalTable},
  methods: {
    validate(){

      this.$refs['TcForm2'].validate((valid) => {

        if (valid) {
          this.$refs['OverSeaTable'].$refs['ostb'].validate((valid) => {
            if (valid) {
              this.$refs['LocalTable'].$refs['LTtb'].validate((valid) => {
                if(valid){
                  this.submitFun();
                }
              });
            }
          });
        } else {


          this.$refs['OverSeaTable'].$refs['ostb'].validate((valid) => {});
          this.$refs['LocalTable'].$refs['LTtb'].validate((valid) => {});
          return false;
        }
      });
    },
    // 表单option加载
    async initOpt() {
      // this.loading = true;
      for (var key in this.Form) {
        let item = this.Form[key];
        if (item.options && item.options.length <= 0) {
          let params = {};
          let {interFaceType, sqlId, attrId, popFlag} = item;
          if (attrId) {
            params = {interFaceType, sqlId, ...{paramStr: 'attrId:' + attrId}};
          } else if (popFlag) {
            params = {interFaceType, sqlId, ...{paramStr: 'popFlag:' + popFlag}};
          }
          const result = await CustOrderService.getExecuteSqlList(params);
          try {
            if (result.meta.resCode == 0) {
              item.options = result.meta.resList.executeSqlResps;
            } else {
              this.$message({
                showClose: true,
                message: result.meta.resultMsg,
                type: 'error'
              });
            }
          } catch {
            this.$message({
              showClose: true,
              message: 'code:' + result.code + '  msg:' + result.msg,
              type: 'error'
            });
          }
        }
      };
      // 表格内运营商获取
      const result2 = await CustOrderService.getExecuteSqlList({
        interFaceType: "ORDER",
        sqlId: "2021060502",
        paramStr: "partnerType:10210003"
      });
      // this.loading = false;
      if (result2.meta.resCode == '0') {
        this.LTtbs.init.field2.OVERSEAS_OPP_ID.options = JSON.parse(JSON.stringify(result2.meta.resList.executeSqlResps));
        this.OStbs.init.field2.OVERSEAS_OPP_ID.options = JSON.parse(JSON.stringify(result2.meta.resList.executeSqlResps));
        if (this.LTtbs.tableData.length > 0) {
          this.LTtbs.tableData.forEach(item => {
            item.field2.OVERSEAS_OPP_ID.options = JSON.parse(JSON.stringify(result2.meta.resList.executeSqlResps));
          })
        }
        if (this.OStbs.tableData.length > 0) {
          this.OStbs.tableData.forEach(item => {
            item.field2.OVERSEAS_OPP_ID.options = JSON.parse(JSON.stringify(result2.meta.resList.executeSqlResps));
          })
        }
      } else {
        this.$message({
          showClose: true,
          message: result.meta.resultMsg,
          type: 'error'
        });
      }
    },
    getDetail() {
      if(!this.ifAdd && this.projectArr.length>0){
        let newArr = [],
            capitalArr = [];
        this.projectArr.forEach((item,index)=>{
          let newObj = {};
          for(var key in item){
            let newKey = this.toCapital(key);
            newObj[newKey]=item[key];
          };
          newArr.push(newObj);
        });
        capitalArr = [...newArr];
        for(var key2 in this.Form){
          this.Form[key2].value = capitalArr[0][key2];
        }
        for(var key2 in this.Form2){
          this.Form2[key2].value = capitalArr[0][key2];
        }
        this.OStbs.resData = [];
        this.LTtbs.resData = [];
        capitalArr.forEach((item2,index)=>{
          if(item2.EXPORT_TYPE == '1'){
            let init = JSON.parse(JSON.stringify(this.OStbs.init));
            for(var key3 in init){
              let its = init[key3];
              for(var key4 in its){
                let its2 = its[key4];
                init[key3][key4].value = item2[key4];
              }
            }
            this.OStbs.tableData.push(init);
            this.OStbs.resData.push(init);
          }else if(item2.EXPORT_TYPE == '2'){
            let init = JSON.parse(JSON.stringify(this.LTtbs.init));
            for(var key3 in init){
              let its = init[key3];
              for(var key4 in its){
                let its2 = its[key4];
                init[key3][key4].value = item2[key4];
              }
            }
            this.LTtbs.tableData.push(init);
            this.LTtbs.resData.push(init);
          }
        });
      }
    },
    async submitFun() {
      if(this.Form.ROUTE_TYPE.value=='88800040001'&&this.OStbs.tableData.length>=2){
        this.$confirm('通达方式为直达方式时，境外国际段/海外公司自有段只能填写一个！', "提示", {
          confirmButtonText: "确定",
          showCancelButton: false,
          type: "warning",
          center: true,
        });
        return false;
      };
      if(!this.bzSomeFun()){
        this.$confirm('币种必须一致！', "提示", {
          confirmButtonText: "确定",
          showCancelButton: false,
          type: "warning",
          center: true,
        });
        return false;
      };
      this.loading = true;
      let p1 = {
            orderItemId: this.allInfo.orderItemId,
            staffId: this.user.staffId,
            staffName: this.user.staffName,
            productType: '3',
      },
          p2=[],
          delp3 = [],
          projectType = null;
      if(this.ifAdd){
        projectType = Number(this.projectType)+1+'';
        p2 = this.paramEnc(projectType,'ADD',this.OStbs.tableData,this.LTtbs.tableData);
      }else{
        projectType = this.projectType+'';
        p2 = this.paramEnc(projectType,'ADD',this.OStbs.tableData,this.LTtbs.tableData);
        if(this.projectArr.length>0){
          delp3 = [{
            projectType: projectType,
            actType: "DEL",
            orderItemId: this.allInfo.orderItemId,
            custId: this.allInfo.custId
          }];
        };
      };
      const result = await CustOrderService.addAbroadPropose({solutionInterProposes:[...delp3,...p2],...p1});

      this.loading = false;
      if(result.meta.resultCode == '0'){
        this.$message({
          type: 'success',
          message: '保存成功!'
        });
        this.$parent.$parent.getDetail();
        this.$emit('update:show',false);
      }else{
        this.$message({
          showClose: true,
          message: result.meta.resultMsg,
          type: 'error'
        });
      }
    },
    // 判断币种是否一致
    bzSomeFun() {
      let BZ_arr = [];
      this.OStbs.tableData.forEach((item,index)=>{
        for(var key in item){
          if(key=='field5'||key=='field6'||key=='field7'){
            let item2 = item[key];
            for(var key in item2){
              let item3 = item2[key];
              BZ_arr.push(item3.opts.value);
            }
          }
        }
      });
      this.LTtbs.tableData.forEach((item,index)=>{
        for(var key in item){
          if(key=='field5'||key=='field6'||key=='field7'||key=='field8'){
            let item2 = item[key];
            for(var key in item2){
              let item3 = item2[key];
              BZ_arr.push(item3.opts.value);
            }
          }
        }
      });
      if (BZ_arr.length > 0) {
        return !BZ_arr.some(function(value, index) {
          return value !== BZ_arr[0];
        });
      } else {
        return true;
      }
    },
    closeFun() {
      this.$emit('update:show', false)
    },
    /**
     * 报文封装
     * @param {Form} 初级参数
     * @returns 报文封装好的
     */
    paramEnc(projectType,actType,OSdata,LTdata) {
      /**
       * 境外国际段/境外本地段  为循环部分   From 部分为公共部分
       * */
      let{custId,orderItemId,nodeId} = this.allInfo,
          newItems=[];
      /**
       * 境外国际段
       * */
      for(var key in OSdata){
        let item = OSdata[key],
            newItem = {};
        for(var key1 in item){
          let 	fields = item[key1];
          for(var key2 in fields){
            let toHumpKey =this.toHump(key2);
            newItem[toHumpKey]= fields[key2].value;
            if(fields[key2].hasOwnProperty("opts")){
              let cur =fields[key2].opts;
              let toHumpKey2 =this.toHump(key2);
              newItem[toHumpKey2+"Cur"] =cur.value;
            }
          }
        }
        /** 公共属性 */
        for(var key3 in this.Form){
          let toHumpKey3 =this.toHump(key3);
          newItem[toHumpKey3] =this.Form[key3].value;
        }
        /** 公共属性 */
        for(var key4 in this.Form2){
          let toHumpKey4=this.toHump(key4);
          newItem[toHumpKey4] =this.Form2[key4].value;
        }
        newItem["confirmFlag"] = 0;
        if (this.allInfo.type == 1 || this.allInfo.type == 3) {
          newItem["createDate"] = this.oldData["CREATE_DATE"];
          newItem["operOrgId"] = this.oldData["OPER_ORG_ID"];
          newItem["operUserId"] = this.oldData["OPER_USER_ID"];
          newItem["operUserName"] = this.oldData["OPER_USER_NAME"];
          newItem["createDy"] = this.oldData["CREATE_BY"];
          newItem["operDate"] = this.oldData["OPER_DATE"];
        } else {
          newItem["createBy"] = "1";
          newItem["operOrgId"] = '__ORG_ID__';
          newItem["operUserId"] =  "__STAFF_ID__"
          newItem["operUserName"] =  "__STAFF_NAME__"
          newItem["operDate"] = '2020-10-10';
        }
        newItem["lastModifyBy"] = "1";
        newItem["lastModifyDate"] = '2020-10-10';
        newItem = {projectType,orderItemId,actType,nodeId,custId,...newItem};
        newItems.push(newItem);
      }
      /**
       * 境外本地段
       * */
      for(var key in LTdata){
        let item = LTdata[key],
            newItem={};
        for(var key1 in item){
          let 	fields = item[key1];
          for(var key2 in fields){
            let toHumpKey =this.toHump(key2);
            newItem[toHumpKey]= fields[key2].value;
            if(fields[key2].hasOwnProperty("opts")){
              let cur =fields[key2].opts;
              let toHumpKey2 =this.toHump(key2);
              newItem[toHumpKey2+"Cur"] =cur.value;
            }
          }
        }
        /** 公共属性 */
        for(var key3 in this.Form){
          let toHumpKey3 =this.toHump(key3);
          newItem[toHumpKey3] =this.Form[key3].value;
        }
        /** 公共属性 */
        for(var key4 in this.Form2){
          let toHumpKey4=this.toHump(key4);
          newItem[toHumpKey4] =this.Form2[key4].value;
        }
        newItem["confirmFlag"] = 0;
        if (this.allInfo.type == 1 || this.allInfo.type == 3) {
          newItem["createDate"] = this.oldData["CREATE_DATE"];
          newItem["operOrgId"] = this.oldData["OPER_ORG_ID"];
          newItem["operUserId"] = this.oldData["OPER_USER_ID"];
          newItem["operUserName"] = this.oldData["OPER_USER_NAME"];
          newItem["createDy"] = this.oldData["CREATE_BY"];
          newItem["operDate"] = this.oldData["OPER_DATE"];
        } else {
          newItem["createBy"] = "1";
          newItem["operOrgId"] = "__ORG_ID__";
          newItem["operUserId"] =  "__STAFF_ID__"
          newItem["operUserName"] =  "__STAFF_NAME__"
          newItem["operDate"] = '2020-10-10';
        }
        newItem["lastModifyBy"] = "1";
        newItem["lastModifyDate"] = '2020-10-10';
        newItem = {projectType,orderItemId,actType,nodeId,custId,...newItem};
        newItems.push(newItem);
      }
      return newItems;
    },
    /**
     * 大写下划线转驼峰
     */
    toHump: (name) => {
      let n = name.toLowerCase(name);
      return n.replace(/_(\w)/g, function(all, letter){
        return letter.toUpperCase();
      });
    },
    /**驼峰转大写**/
    toCapital: (name)=>{
      var tfname = '';
      var array = name.split('');
      for(var i=0;i<array.length;i++){
        if(i==array.length-1) {tfname=name;break}
        let v = array[i],
            v2 = array[i+1];
        if(/^[a-z]+$/.test(v)){
          if(/^[a-z]+$/.test(v2)){
            tfname = name.replace(/([A-Z])/g,"_$1").toUpperCase();
            break;
          }
        }
      };
      return tfname
    }
  }
}
</script>

<style lang="scss" scoped>
.ne-title-v2 {
  margin-bottom: .1rem;
}
</style>
